﻿@using NGroup.VTL.Models;
@using NGroup.VTL.Core.Const;
@{
    ViewBag.Title = @Lang.trangchu_pageheader;
    Dictionary<string, List<ProductModel>> data = ViewBag.Products as Dictionary<string, List<ProductModel>>;

    List<ProductModel> sanphammoi = null, thenhuamoi = null, daydeomoi = null, tintucmoi = null;

    if (data != null)
    {
        data.TryGetValue(GeneralConfiguration.TrangChu_SanPhamMoi, out sanphammoi);
        data.TryGetValue(GeneralConfiguration.TrangChu_TheNhuaMoi, out thenhuamoi);
        data.TryGetValue(GeneralConfiguration.TrangChu_DayDeoMoi, out daydeomoi);
        data.TryGetValue(GeneralConfiguration.TrangChu_TinTucMoi, out tintucmoi);
    }

    int counter = 0;
}
<div class="art-post">
    <div class="art-post-body">
        <div class="art-post-inner">
            <div class="art-postcontent">
                @Html.Partial("gioi_thieu_cty", new ViewDataDictionary { { "pagetype", 1 } })
                <!-- article-content -->
                @if (sanphammoi != null && sanphammoi.Count > 0)
                {
                    <div class="art-block">
                        <div class="art-block-body">
                            <div class="art-blockheader itemListHeader">
                                <h2 class="t">
                                    @Lang.trangchu_sanphammoi</h2>
                            </div>
                            <div class="art-blockcontent">
                                <div class="art-blockcontent-body">
                                    <!-- block-content -->
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tbody>
                                            @foreach (var item in sanphammoi)
                                            {
                                                var url = string.Join("/", new string[] { item.SupTypeIDString, item.TypeIDString, item.UniqueString });
                                                if (counter % 3 == 0)
                                                {
                                                @Html.Raw("<tr>");
                                                }
                                            
                                                <td>
                                                    <!-- The product name DIV. -->
                                                    <div class="product-style1">
                                                        <div style="line-height: 14px; margin-bottom: 5px; text-align: center;">
                                                            <a style="font-size: 12px;" class="product-style2" title="@item.Title" href="@url">
                                                                @item.Title</a>
                                                            <br />
                                                        </div>
                                                        <!-- The product image DIV. -->
                                                        <div style="height: 120px;">
                                                            <a class="hasTip" href="@url">
                                                                <img src="@item.ImageSmallURL" height="150" width="150" alt="@item.Title"
                                                                border="0">
                                                                <div class="tootlipContent hidden" title="@item.Title">
                                                                    <img src="@item.ImageLargeURL" alt="@item.Title" border="0"></div>
                                                            </a>
                                                        </div>
                                                        <!-- The product price DIV. -->
                                                        <div style="text-align: center; color: black;">
                                                        </div>
                                                        <!-- The add to cart DIV. -->
                                                        <div style="text-align: center;">
                                                        </div>
                                                    </div>
                                                </td>
                                            
                                                if (counter % 3 == 2)
                                                {
                                                @Html.Raw("</tr>");
                                                }

                                                counter++;
                                            }
                                        </tbody>
                                    </table>
                                    <!-- /block-content -->
                                    <div class="cleared">
                                    </div>
                                </div>
                            </div>
                            <div class="cleared">
                            </div>
                        </div>
                    </div>
                }
                @if (daydeomoi != null && daydeomoi.Count > 0)
                {
                    <div class="art-block">
                        <div class="art-block-body">
                            <div class="art-blockheader">
                                <div class="t">
                                    @Lang.trangchu_daydeothenhanvien</div>
                            </div>
                            <div class="art-blockcontent">
                                <div class="art-blockcontent-body">
                                    <!-- block-content -->
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tbody>
                                            @{counter = 0;}
                                            @foreach (var item in daydeomoi)
                                            {
                                                var url = string.Join("/", new string[] { item.SupTypeIDString, item.TypeIDString, item.UniqueString });

                                                if (counter % 3 == 0)
                                                {
                                                @Html.Raw("<tr>");
                                                }
                                            
                                                <td>
                                                    <!-- The product name DIV. -->
                                                    <!-- The product name DIV. -->
                                                    <div class="product-style1">
                                                        <div style="line-height: 14px; margin-bottom: 5px; text-align: center;">
                                                            <a style="font-size: 12px;" class="product-style2" title="@item.Title" href="@url">
                                                                @item.Title</a>
                                                            <br />
                                                        </div>
                                                        <!-- The product image DIV. -->
                                                        <div style="height: 120px;">
                                                            <a class="hasTip" href="@url">
                                                                <img src="@item.ImageSmallURL" height="150" width="150" alt="@item.Title"
                                                                border="0">
                                                                <div class="tootlipContent hidden" title="@item.Title">
                                                                    <img src="@item.ImageLargeURL" height="400" alt="@item.Title" border="0"></div>
                                                            </a>
                                                        </div>
                                                        <!-- The product price DIV. -->
                                                        <div style="text-align: center; color: black;">
                                                        </div>
                                                        <!-- The add to cart DIV. -->
                                                        <div style="text-align: center;">
                                                        </div>
                                                    </div>
                                                </td>
                                            
                                                if (counter % 3 == 2)
                                                {
                                                @Html.Raw("</tr>");
                                                }

                                                counter++;
                                            }
                                        </tbody>
                                    </table>
                                    <!-- /block-content -->
                                    <div class="cleared">
                                    </div>
                                </div>
                            </div>
                            <div class="cleared">
                            </div>
                        </div>
                    </div>
                }
                @if (thenhuamoi != null && thenhuamoi.Count > 0)
                {
                    <div class="art-block">
                        <div class="art-block-body">
                            <div class="art-blockheader">
                                <div class="t">
                                    @Lang.trangchu_thenhua</div>
                            </div>
                            <div class="art-blockcontent">
                                <div class="art-blockcontent-body">
                                    <!-- block-content -->
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tbody>@Html.Raw("<tr>")
                                            @{counter = 0;}
                                            @foreach (var item in thenhuamoi)
                                            {
                                                var url = string.Join("/", new string[] { item.SupTypeIDString, item.TypeIDString, item.UniqueString });

                                                if (counter % 3 == 0)
                                                {
                                                @Html.Raw("<tr>");
                                                }   
                                            
                                                <td>
                                                    <!-- The product name DIV. -->
                                                    <!-- The product name DIV. -->
                                                    <div class="product-style1">
                                                        <div style="line-height: 14px; margin-bottom: 5px; text-align: center;">
                                                            <a style="font-size: 12px;" class="product-style2" title="@item.Title" href="@url">
                                                                @item.Title</a>
                                                            <br />
                                                        </div>
                                                        <!-- The product image DIV. -->
                                                        <div style="height: 120px;">
                                                            <a class="hasTip" href="@url">
                                                                <img src="@item.ImageSmallURL" height="150" width="150" alt="@item.Title"
                                                                border="0">
                                                                <div class="tootlipContent hidden" title="@item.Title">
                                                                    <img src="@item.ImageLargeURL" height="400" alt="@item.Title" border="0"></div>
                                                            </a>
                                                        </div>
                                                        <!-- The product price DIV. -->
                                                        <div style="text-align: center; color: black;">
                                                        </div>
                                                        <!-- The add to cart DIV. -->
                                                        <div style="text-align: center;">
                                                        </div>
                                                    </div>
                                                </td>
                                            
                                                if (counter % 3 == 2)
                                                {
                                                @Html.Raw("</tr>")
                                                }

                                                counter++;
                                            }
                                        </tbody>
                                    </table>
                                    <!-- /block-content -->
                                    <div class="cleared">
                                    </div>
                                </div>
                            </div>
                            <div class="cleared">
                            </div>
                        </div>
                    </div>
                }
                @if (tintucmoi != null && tintucmoi.Count > 0)
                {
                    <!-- /article-content -->
                    <div class="art-block">
                        <div class="art-block-body">
                            <div class="art-blockheader">
                                <div class="t">
                                    @Lang.trangchu_tintuc</div>
                            </div>
                            <div class="art-blockcontent">
                                <div class="art-blockcontent-body">
                                    <!-- article-content -->
                                    @foreach (var item in tintucmoi)
                                    { 
                                        <div class="art-article">
                                            <div style="text-align: justify;">
                                                <a href="/tin-tuc/chi-tiet/@item.UniqueString">
                                                    <img alt="" src="@item.ImageSmallURL" align="left" style="width: 120px;
                                                    height: 90px; margin: 0px 6px;" border="0"></a> <a href="/tin-tuc/chi-tiet/@item.UniqueString">
                                                        <h6>
                                                            @item.Title</h6>
                                                    </a>
                                                <p>
                                                    @Html.Raw(item.Content)
                                                    [&nbsp;…&nbsp;]</p>
                                            </div>
                                        </div>
                                        <span class="article_separator">&nbsp;</span>
                                    }
                                    <!-- /article-content -->
                                    <div class="cleared">
                                    </div>
                                </div>
                            </div>
                            <div class="cleared">
                            </div>
                        </div>
                    </div>
                }
            </div>
            <div class="cleared">
            </div>
        </div>
        <div class="cleared">
        </div>
    </div>
</div>
